﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NguyenQuangKhanh_785255
{
    class QueryString
    {
        Connect conn = new Connect();
        public DataTable ShowOrder()
        {
            DataTable tb = new DataTable(); ;
            try
            {
                string sql = "select *from [Order]";
                tb = conn.getTable(sql);
            }
            catch { }
            return tb;
        }
        public DataTable ShowOrder(string ma)
        {
            DataTable tb = new DataTable(); ;
            try
            {
                string sql = "select OrderDate, Name from [Order],Customer where [Order].CustomerID = Customer.CustomerID and OrderID = '"+ma+"'";
                tb = conn.getTable(sql);
            }
            catch { }
            return tb;
        }
        public DataTable ShowOrderDeTail(string ma)
        {
            DataTable tb = new DataTable(); ;
            try
            {
                string sql = "select Product.ProductID, Description, OrderDetail.Price, OrderDetail.Quantity, Quantity*OrderDetail.Price as [Amount] from OrderDetail, Product where OrderDetail.ProductID = Product.ProductID and OrderID = '"+ma+"'";
                tb = conn.getTable(sql);
            }
            catch { }
            return tb;
        }
    }
}
